// src/stores/clusterStore.js
import { defineStore } from 'pinia';

export const useClusterStore = defineStore('cluster', {
  state: () => ({
    currentCluster: null, // 存储整个集群对象
  }),
  actions: {
    // 设置当前选中的集群信息
    setCurrentCluster(cluster) {
      this.currentCluster = cluster;
    },
    // 清除当前选中的集群信息
    clearCurrentCluster() {
      this.currentCluster = null;
    },
  },
  getters: {
    // 提供计算属性来获取当前选中的集群信息
    currentClusterInfo: (state) => state.currentCluster,
  },
});